import 'dart:ffi';

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class MemberPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text('会员中心'),
      ),
      body: ListView(
        children: <Widget>[
          _topHeader(),
          _orderTitle(),
          _ordertype(),
          _actionlist(),
        ],
      ),
    );
  }
  

  Widget _topHeader() {
    return Container(
      width: ScreenUtil().setWidth(750),
      padding: EdgeInsets.all(20),
      color: Colors.pinkAccent,
      child: Column(
        children: <Widget>[
          Container(
            margin: EdgeInsets.only(top: 30),
            height:  ScreenUtil().setWidth(200),
            width: ScreenUtil().setWidth(200),
            decoration: BoxDecoration(
                color: Colors.yellow,
                borderRadius: BorderRadius.all(
                Radius.circular(100),
              ),
              image: DecorationImage(
                image: NetworkImage("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1572260677704&di=245b018870051d15bcac3de4faff9367&imgtype=0&src=http%3A%2F%2Fpic.baike.soso.com%2Fp%2F20140129%2F20140129141240-1554449676.jpg"),
                fit:BoxFit.cover,
              )
            ),
          ),
          Container(
            margin: EdgeInsets.only(top: 10),
            child: Text(
               '会员007',
               style: TextStyle(
                 fontSize: ScreenUtil().setSp(36),
                 color: Colors.white,
               ),
  
            ),
          )
        ],
      ),
    );
  }


  Widget _orderTitle() {
    return Container(
      margin: EdgeInsets.only(top: 10),
      decoration: BoxDecoration(
        color: Colors.white,
        border: Border(
          bottom: BorderSide(width: 1,color: Colors.black12)
        )
      ),
      child: ListTile(
        leading: Icon(Icons.list),
        title: Text('我的订单'),
        trailing: Icon(Icons.arrow_right),
      ),
    );
  }

  Widget _ordertype() {
    return Container(
      margin: EdgeInsets.only(top: 5),
      width: ScreenUtil().setWidth(750),
      height: ScreenUtil().setHeight(150),
      padding: EdgeInsets.only(top: 20),
      color: Colors.white,
      child: Row(
        children: <Widget>[
          Container(
            width: ScreenUtil().setWidth(187),
            child: Column(
              children: <Widget>[
                Icon(Icons.party_mode,size: 30),
                Text('待付款'),
              ],
            ),
          ),
          Container(
            width: ScreenUtil().setWidth(187),
            child: Column(
              children: <Widget>[
                Icon(Icons.query_builder,size: 30),
                Text('待发货'),
              ],
            ),
          ),
          Container(
            width: ScreenUtil().setWidth(187),
            child: Column(
              children: <Widget>[
                Icon(Icons.directions_car,size: 30),
                Text('待收货'),
              ],
            ),
          ),
          Container(
            width: ScreenUtil().setWidth(187),
            child: Column(
              children: <Widget>[
                Icon(Icons.content_paste,size: 30),
                Text('待评价'),
              ],
            ),
          )
        ],
      ),
    );
  }

  Widget _myListTitle(String title){
    return Container(
      decoration: BoxDecoration(
        color: Colors.white,
        border: Border(
          bottom: BorderSide(width: 1,color: Colors.black12),
        )
      ),
      child: ListTile(
        leading: Icon(Icons.blur_circular),
        title: Text(title),
        trailing: Icon(Icons.arrow_right),
      ),
    );
  }

  Widget _actionlist(){
    return Container(
      margin: EdgeInsets.only(top: 10),
      child: Column(
        children: <Widget>[
          _myListTitle("领取优惠券"),
          _myListTitle("已领取优惠劵"),
          _myListTitle("地址管理"),
          _myListTitle("客服电话"),
          _myListTitle("关于我们"),
        ],
      ),
    );
  }
}
